import Vue from 'vue'
import App from './App.vue'

// 注册全局组件
import TypeNav from '@/components/TypeNav'
import Carousel from '@/components/Carousel'
import Pagination from '@/components/Pagination'
Vue.component(TypeNav.name, TypeNav)
Vue.component(Carousel.name, Carousel)
Vue.component(Pagination.name, Pagination)

Vue.config.productionTip = false
// 注册路由
import router from '@/router'

// 注册vuex
import store from '@/store'

// 引入mock数据
import '@/mock/mockSever'

// 引入swiper
import 'swiper/css/swiper.min.css'

// 引入API接口（在不使用vuex的情况下）
import * as API from '@/api'

// 引入element-ui
import 'element-ui/lib/theme-chalk/index.css';
import { MessageBox,Button} from 'element-ui';
Vue.component(Button.name, Button);
Vue.prototype.$msgbox = MessageBox;
Vue.prototype.$alert = MessageBox.alert;

import VueLazyload from 'vue-lazyload'

// 导入需要懒加载的图片
import atm from '@/assets/images/1.jpeg'

// 图片懒加载
Vue.use(VueLazyload, {
  // 需要懒加载的默认的图片
 loading:atm
})

/* import myPlugins from '@/plugins/myPlugins.js'
Vue.use(myPlugins,{
  name: 'myPlugins'
})
 */
new Vue({
  render: h => h(App),
  // 注册全局事件总线
  beforeCreate(){
    Vue.prototype.$bus = this
    Vue.prototype.$API= API 
  },
  router,
  store
}).$mount('#app')
